<ui:composition 
	  xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets" template="/home.xhtml">
	<ui:define name="corpo">
		<h:form prependId="false">
			<p:fieldset legend="Dados Pessoais" toggleable="true" style="margin-top:20px;float:left;width:100%;font-size:13px">			
				
				<h:panelGrid columns="4" cellpadding="3" cellspacing="0" id="pnl1">
			
					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.nome']}" for="nome" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputText value="#{manterPacienteBean.pacienteForm.paciente.nome}" size="30" maxlength="100" required="true" label="nome" id="nome" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="nome" id="msgNome" styleClass="msg_erro_required"/>
					</h:panelGroup>

					
					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.cpf']}" for="cpf" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputMask value="#{manterPacienteBean.pacienteForm.paciente.cpf}" mask="999.999.999-99" size="15" maxlength="14" required="true" label="cpf" id="cpf" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro">
							<f:converter converterId="com.automed.cpfConverter"/>
							<f:validator validatorId="com.automed.cpfValidator"/>
							<f:validator validatorId="com.automed.cpfValidatorExistente"/>
						</p:inputMask>
						<h:message for="cpf" id="msgCPF" styleClass="msg_erro_required"/>
						<p:spacer width="10" />
						<h:outputText value="(Ex: 999.999.999-99)" styleClass="fmt_exemplo_preechimento" />
					</h:panelGroup>
					
					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.rg']}" for="rg" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputText value="#{manterPacienteBean.pacienteForm.paciente.rg}" size="12" maxlength="12" required="true" label="rg" id="rg" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="rg" id="msgRG" styleClass="msg_erro_required"/>
					</h:panelGroup>

					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.dataNascimento']}" for="dataNascimento" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputMask value="#{manterPacienteBean.pacienteForm.paciente.dataNascimento}" mask="99/99/9999" size="12" required="true" label="Data de nascimento" id="dataNascimento" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro">
							<f:convertDateTime pattern="dd/MM/yyyy" locale="pt_BR" timeZone="GMT-3" />
						</p:inputMask>
						<h:message for="dataNascimento" id="msgDataNascimento" styleClass="msg_erro_required"/>
						<p:spacer width="10" />
						<h:outputText value="(Ex: dd/mm/aaaa)" styleClass="fmt_exemplo_preechimento" />
					</h:panelGroup>
					
					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.sexo']}" for="sexo" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<h:selectOneMenu value="#{manterPacienteBean.pacienteForm.paciente.sexo}" required="true" id="sexo" style="font-size:12px">
							<f:selectItem itemLabel="" noSelectionOption="true" />
							<f:selectItem itemLabel="Feminino" itemValue="F" />
							<f:selectItem itemLabel="Masculino" itemValue="M" />
						</h:selectOneMenu>
						<h:message for="sexo" id="msgSexo" styleClass="msg_erro_required"/>
					</h:panelGroup>


					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.login']}" for="login" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputText value="#{manterPacienteBean.pacienteForm.paciente.login}" size="10" maxlength="50" required="true" label="login" id="login" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="login" id="msgLogin" styleClass="msg_erro_required"/>
					</h:panelGroup>


					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.senha']}" for="senha" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:password value="#{manterPacienteBean.pacienteForm.paciente.senha}"  
                        	promptLabel="Por favor, digite sua senha" feedback="true" weakLabel="Fraca" minLength="6" goodLabel="Média" strongLabel="Forte" size="10" maxlength="20" required="true" style="border: solid 1px #5FA03F;background-color: #FFF;" label="senha" id="senha" password="true" styleClass="fmt_input_form_cadastro">
                        	<f:validateLength minimum="6" maximum="6" />
                        </p:password>
						<h:message for="senha" id="msgSenha" styleClass="msg_erro_required"/>
						<p:spacer width="10" />
						<h:outputText value="(Digite 6 caracteres) " styleClass="fmt_exemplo_preechimento" />
					</h:panelGroup>


					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.confirmaSenha']}" for="confirmaSenha" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:password value="#{manterPacienteBean.pacienteForm.paciente.confirmaSenha}" feedback="false" minLength="6" promptLabel="Por favor, digite sua senha novamente para confirmação" size="10" maxlength="20" required="true" style="border: solid 1px #5FA03F;background-color: #FFF;" label="confirmar senha" id="confirmaSenha" password="true" styleClass="fmt_input_form_cadastro" />
						<h:message for="confirmaSenha" id="msgConfirmaSenha" styleClass="msg_erro_required"/>
					</h:panelGroup>


					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.email']}" for="email" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputText value="#{manterPacienteBean.pacienteForm.paciente.email}" size="30" maxlength="50" required="true" label="email" id="email" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro">
							<f:validator validatorId="com.automed.emailValidator"/>
						</p:inputText>
						<h:message for="email" id="msgEmail" styleClass="msg_erro_required"/>
					</h:panelGroup>


					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.matricula']}" for="matricula" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputMask value="#{manterPacienteBean.pacienteForm.paciente.matricula}" mask="9999999999" size="13" maxlength="10" required="true" label="matricula" id="matricula" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:panelGroup>
							<h:message for="matricula" id="msgMatricula" styleClass="msg_erro_required"/>
							<p:tooltip for="matricula" value="Por favor, digite a matrícula fornecida pelo seu convênio" showEvent="focus" hideEvent="blur"/>
						</h:panelGroup>
					</h:panelGroup>

					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.convenio']}" for="convenio" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<h:selectOneMenu value="#{manterPacienteBean.pacienteForm.paciente.convenio}" id="convenio" required="true" style="font-size:12px">
							<f:selectItem itemLabel="" noSelectionOption="true" />
							<f:selectItems value="#{manterPacienteBean.pacienteForm.convenios}" var="entity" itemLabel="#{entity.convenio}" itemValue="#{entity}" />
						</h:selectOneMenu>
						<h:panelGroup>
							<h:message for="convenio" id="msgConvenio" styleClass="msg_erro_required" />
							<p:tooltip for="convenio" value="Por favor, escolha o convênio equivalente a sua matrícula" showEvent="focus" hideEvent="blur"/>
						</h:panelGroup>
					</h:panelGroup>
				
					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="Fone residencial:" for="tel1" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputMask value="#{manterPacienteBean.pacienteForm.residencial.telefone}" converter="com.automed.marcaraFoneConverter" mask="(99)9999-9999"  required="true" label="Residencial" id="tel1" size="15" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="tel1" id="msgTEL1" styleClass="msg_erro_required"/>
						<p:spacer width="10" />
						<h:outputText value="(Ex: (99)9999-9999)" styleClass="fmt_exemplo_preechimento" />
					</h:panelGroup>


					<h:outputLabel value="Fone celular:" for="tel2" styleClass="fmt_label_form_cadastro" />
					<h:panelGroup>
						<p:inputMask value="#{manterPacienteBean.pacienteForm.celular.telefone}" mask="(99)9999-9999" converter="com.automed.marcaraFoneConverter" label="tel2" id="tel2" size="15" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="tel2" id="msgTEL2" />
						<p:spacer width="10" />
						<h:outputText value="(Ex: (99)9999-9999)" styleClass="fmt_exemplo_preechimento" />
					</h:panelGroup>

					<h:outputLabel value="Fone comercial:" for="tel3" styleClass="fmt_label_form_cadastro" />
					<h:panelGroup>
						<p:inputMask value="#{manterPacienteBean.pacienteForm.comercial.telefone}" mask="(99)9999-9999" converter="com.automed.marcaraFoneConverter" label="tel3" id="tel3" size="15" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="tel3" id="msgTEL3" />
						<p:spacer width="10" />
						<h:outputText value="(Ex: (99)9999-9999)" styleClass="fmt_exemplo_preechimento" />
					</h:panelGroup>
						
				</h:panelGrid>

			</p:fieldset>
			<br/>
			<p:fieldset legend="Endereço" toggleable="true" style="margin-top:20px;float:left;width:100%;font-size:13px">
			
				<h:panelGrid columns="2" cellpadding="3" cellspacing="0" id="pnl2">

					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.cep']}" for="cep" styleClass="fmt_label_form_cadastro" />						
					</h:panelGroup>
					<h:panelGroup>
						<p:inputMask value="#{manterPacienteBean.pacienteForm.paciente.endereco.cep}" mask="99999-999" size="10" maxlength="8" required="true" label="cep" id="cep" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="cep" id="msgCEP" styleClass="msg_erro_required"/>
						<p:spacer width="10" />
						<h:outputText value="(Ex: 99999-999)" styleClass="fmt_exemplo_preechimento" />
					</h:panelGroup>
					
					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.logradouro']}" for="logradouro" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputText value="#{manterPacienteBean.pacienteForm.paciente.endereco.endereco}" required="true" size="50" maxlength="100" label="logradouro" id="logradouro" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="logradouro" id="msgLogradouro" styleClass="msg_erro_required"/>
					</h:panelGroup>

					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.numero']}" for="numero" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputMask value="#{manterPacienteBean.pacienteForm.paciente.endereco.numero}" required="true" mask="?999999" size="6" label="numero" id="numero" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="numero" id="msgNumero" styleClass="msg_erro_required" />
					</h:panelGroup>	

					<h:panelGroup>						
						<h:outputLabel value="#{msg['display.label.paciente.complemento']}" for="complemento" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputText value="#{manterPacienteBean.pacienteForm.paciente.endereco.complemento}" required="false" size="30" maxlength="50" label="complemento" id="complemento" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="complemento" id="msgComplemento" styleClass="msg_erro_required"/>
					</h:panelGroup>
					
					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.cidade']}" for="cidade" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<h:selectOneMenu value="#{manterPacienteBean.pacienteForm.paciente.endereco.cidade}" required="true" id="cidade" style="font-size:12px">
							<f:selectItem itemLabel="" noSelectionOption="true" />
							<f:selectItems value="#{manterPacienteBean.pacienteForm.cidades}" var="entity" itemLabel="#{entity.cidade}" itemValue="#{entity}" />
						</h:selectOneMenu>
						<h:message for="cidade" id="msgCidade" styleClass="msg_erro_required"/>
					</h:panelGroup>
					
					<h:panelGroup>
						<font class="campoObrigatorio">*</font>
						<h:outputLabel value="#{msg['display.label.paciente.bairro']}" for="bairro" styleClass="fmt_label_form_cadastro" />
					</h:panelGroup>
					<h:panelGroup>
						<p:inputText value="#{manterPacienteBean.pacienteForm.paciente.endereco.bairro}" required="true" size="30" maxlength="100" label="bairro" id="bairro" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						<h:message for="bairro" id="msgBairro" styleClass="msg_erro_required"/>
					</h:panelGroup>
					
				</h:panelGrid>
				
			</p:fieldset>
			<br />
			<p:fieldset legend="Termos" toggleable="true" style="margin-top:20px;float:left;width:100%;font-size:13px" id="pnl3">
				
				<p:inputTextarea cols="100" value="#{autenticaUsuarioBean.form.termos}" maxHeight="60" styleClass="fmt_input_form_cadastro" readonly="true" autoResize="true" rows="5" />
				<br />
				
				<h:selectBooleanCheckbox value="#{manterPacienteBean.pacienteForm.aceito}" id="termos">
					<p:ajax event="change" update="btCadastrar" />
				</h:selectBooleanCheckbox>
				<h:outputText value="Li, aceito os termos descritos." />
				<br />
				
			</p:fieldset>
			

				
			<br/>
			<p:commandButton id="btCadastrar" value="#{msg['display.view.cadastrar']}" disabled="#{!manterPacienteBean.pacienteForm.aceito}" style="margin-top:10px" ajax="false" action="#{manterPacienteBean.cadastrar}" update="pnl1, pnl2,pnl3,msgTermos">
				<f:param name="modal" value="true" />
			</p:commandButton>
			<p:button value="#{msg['display.view.voltar']}" outcome="/home" style="margin-left:10px; margin-top:10px" />
		</h:form>
	</ui:define>
</ui:composition>